<template>
	<view class="community">
		<view class="head_bg" style="height: 250rpx;">
			<view class="ele_title_left padding-left-sm padding-bottom-xs">
				<view class="ele_title_inner padding-xs">
					<image class="ele_address_img" src="../../common/img/gongsi_bai.png" mode=""></image>
				    <text class="text-white">{{info.residential_quarters_name}}</text></view>
				<view class="ele_address padding-xs">
					<image class="ele_address_img" src="../../common/img/dizhi_bai.png" mode=""></image>
					<text class="text-white">{{info.residential_quarters_address}}</text>
				</view>
			</view>
		</view>
		<view class="big_box" style="height: auto;top:0">
			<view class="big_box_inner">
				<view class="big_inner_one">
					<view class="flex padding-sm">
						<view class="flex-sub  package-title">{{name}}</view>
					</view>
				</view>
			</view>
		</view>
		<view class="cu-bar bg-white solid-bottom" style="margin-top:-50rpx">
			<view class="action">购买记录</view>
		</view>
		<view class="cu-list menu">
			<view class="cu-item arrow solid-bottom" v-for="(info,index) in list" :key="index">
				<view class="content padding-tb-sm">
					<view>{{info.nick_name}}</view>
				</view>
				<view class="action">{{info.pay_time}}</view>
			</view>
		</view>
		<view style="height:100rpx;"></view>		
	</view>
</template>

<script>
	let page=1,timer=null
	export default {
		data() {
			return {
				id:[],
				info:{},
				name:[],
				list:[],
				loadingTxt:'加载更多',
				inputval:"",
				/* iconname:"unfold", */
			}
		},
		onLoad(e) {
			this.info=JSON.parse(e.info);
		    this.id=e.id;
			this.name=e.name;
		},
		onShow() {
			page=1;
			this.gatdata();
		},
		methods: {
			gatdata(){
				let that=this;
				that.http.tokenreq({
					url: 'setmeal/v1/buglog',
					data:{"pageindex":page,
					      "set_meal_guid":this.id
					}
				}).then((res) => {
					let e=res.data;
					if(e.code==0 && e.success){
						let list=e.rows;
						that.list=list;
						page++;
					}else{
						uni.showModal({
							content:e.message,
							showCancel:false,
						})
					}
				})
			},
			getmorelist(){
				this.loadingTxt='加载中'
				let that=this;
				that.http.tokenreq({
					url: 'setmeal/v1/buglog',
					data:{"pageindex":page,
					      "set_meal_guid":this.id
					}
				}).then((res) => {
					uni.hideLoading();
					let e=res.data;
					if(e.code==0 && e.success){
						if(e.rows.length==0){
							that.loadingTxt="已经加载全部";
							return;
						}
						that.list=that.list.concat(e.rows);
						page++
					}else{
						uni.showModal({
							content:e.message,
							showCancel:false,
						})
					}
				})
			},
			onReachBottom() {
				//阻止重复加载
				if(timer !== null){
					clearTimeout(timer)
				}
				timer=setTimeout(()=>this.getmorelist(),500)
				// this.getMoreNews()
			},
		}
	}
</script>
<style>
	.detail_br{
		height:60rpx !important;
	}
	.big_inner_two{
		margin-bottom: 0px;
	}
	page{
		background-color: #FFFFFF;
	}
	.big_inner_one{
		padding: 0;
	}
	.package-title{
		color: #000000;
		font-size: 32rpx;
		vertical-align: middle
	}
	.border{
		border-bottom: 2rpx dotted #EEEEEE;
	}
	.border-top{
		border-top: 2rpx dotted #EEEEEE;
	}
</style>
